<template>
  <section class="group-list">
    <simple-slot title="我管理的圈子">
      <Button type="primary" icon="md-paper" @click="doNew">
        创建圈子
      </Button>
    </simple-slot>
    <Row>
      <Col span="6" v-for="i in list" :key="i.id">
        <grop-item :data="i" :type="1"></grop-item>
      </Col>
    </Row>
    <simple-title title="我参与的列表" :show="true"></simple-title>
    <Row>
      <Col span="6" v-for="i in inlist" :key="i.id">
        <grop-item :data="i" :type="1"></grop-item>
      </Col>
    </Row>
    <simple-title title="国内同城" :show="true"></simple-title>
    <Row>
      <Col span="6" v-for="i in inlist" :key="i.id">
        <grop-item :data="i" :type="1"></grop-item>
      </Col>
    </Row>
    <simple-title title="国外整形圈" :show="true"></simple-title>
    <Row>
      <Col span="6" v-for="i in inlist" :key="i.id">
        <grop-item :data="i" :type="1"></grop-item>
      </Col>
    </Row>
    <simple-title title="推荐的热圈" :show="true"></simple-title>
    <Row>
      <Col span="6" v-for="i in inlist" :key="i.id">
        <grop-item :data="i" :type="1"></grop-item>
      </Col>
    </Row>
  </section>
</template>

<script>
import SimpleSlot from '../../../components/Title/SimpleSlot'
import SimpleTitle from '../../../components/Title/SimpleTitle'
import GropItem from '../../../components/ListItem/GroupItem'
export default {
  name: 'GroupList',
  components: {
      SimpleSlot,
      SimpleTitle,
      GropItem
  },
   data () {
      return {
        list: [],
        inlist: []
      }
   },
    created () {
      this.getinfo()
    },
    computed: {
    },
    methods: {
        doNew () {
            this.$router.push({path: '/my/mygroup/publishtheme'})
        },
        getinfo () {
            let _this =this
            _this.$post('/api/circle/myCircle',
                {
                    token:_this.$token,
                    status:''
                }, function (res) {
                    _this.list = res.data
                    _this.list.forEach(function (i) {
                        _this.$set(i,'type',1)
                    })

                }, function (errmsg) {
                    _this.$message.error(errmsg);
                })
            _this.$post('/api/circle/myAddCircle',
                {
                    token:_this.$token,
                }, function (res) {
                    _this.inlist = res.data
                    _this.inlist.forEach(function (i) {
                        _this.$set(i,'type',2)
                    })
                }, function (errmsg) {
                    _this.$message.error(errmsg);
                })
        }
    }
}

</script>

<style lang="less" scoped>
  @import "../../../style/style.less";
  .group-list {
    border: 1px solid @border-color;
    padding: 15px;
  }
</style>
